package com.woniuxy.table.app.apiImpl;

import cn.hutool.core.bean.BeanUtil;
import com.woniuxy.cloud.mall95.log.Log;
import com.woniuxy.table.client.DiningAreaMannageClient;
import com.woniuxy.table.client.param.AddDiningAreaParam;
import com.woniuxy.table.client.param.ModifyDiningAreaParam;
import com.woniuxy.table.service.DiningAreaService;
import com.woniuxy.table.service.param.AddDiningAreaServiceParam;
import com.woniuxy.table.service.param.ModifyDiningAreaServiceParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import result.Result;

@RestController
public class DiningAreaMannageApiImpl implements DiningAreaMannageClient {
    @Autowired
    private DiningAreaService diningAreaService;
    @Log("添加餐桌区域")
    @Override
    public Result addDiningArea(AddDiningAreaParam addDiningAreaParam) {
        AddDiningAreaServiceParam addDiningAreaServiceParam = BeanUtil.toBean(addDiningAreaParam, AddDiningAreaServiceParam.class);
        diningAreaService.addDiningArea(addDiningAreaServiceParam);
        return Result.success("添加餐桌区域成功");
    }
    @Log("修改餐桌区域")
    @Override
    public Result modifyDiningArea(ModifyDiningAreaParam modifyDiningAreaParam) {
        ModifyDiningAreaServiceParam modifyDiningAreaServiceParam = BeanUtil.toBean(modifyDiningAreaParam, ModifyDiningAreaServiceParam.class);
        diningAreaService.modifyDiningArea(modifyDiningAreaServiceParam);
        return Result.success("修改餐桌区域成功");
    }
    @Log("删除餐桌区域")
    @Override
    public Result deleteDiningArea(Integer storeId, Integer diningAreaId) {
        diningAreaService.deleteDiningArea(storeId,diningAreaId);
        return Result.success("删除餐桌区域成功");
    }
}
